var mysql = require('mysql');
var sqlCollection = function  (sql,callback) {
        var connection = mysql.createConnection({
            host     : '127.0.0.1',
            user     : 'root',
            password : 'qaz123456',
            database : 'official_account'
        });
        
        connection.connect();
        
        connection.query(sql, function (error, results, fields) {
            callback({error, results, fields})
        });
        connection.end();
}

module.exports = sqlCollection;